append([], X, [X]).
append([H|T], X, [H|Z]) :- append(T, X, Z).

reverse([], []).
reverse([X|L1], L2) :- reverse(L1, RL1), append(RL1, X, L2).

